using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using FytSoa.Domain.Core.Result;
using Quartz;

namespace FytSoa.Quartz
{
    //任务调度接口
    public interface IQuartzService
    {
        /// <summary>
        /// 初始化开启任务调度器
        /// </summary>
        /// <returns></returns>
        Task<bool> InitStart();

        /// <summary>
        /// 添加任务
        /// </summary>
        /// <param name="type">类</param>
        /// <param name="jobKey">键</param>
        /// <param name="trigger">触发器</param>
        /// <returns></returns>
        Task<ApiResult<string>> Add(Type type, JobKey jobKey, ITrigger trigger = null);

        /// <summary>
        /// 添加一个http请求的任务
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<ApiResult<string>> Add(SchedulerEntity entity);

        /// <summary>
        /// 触发执行任务
        /// </summary>
        /// <param name="jobKey"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        Task TriggerAction(JobKey jobKey, JobActionEnum action);

        /// <summary>
        /// 根据任务查询运行日志
        /// </summary>
        /// <returns></returns>
        Task<List<string>> JobLogs(JobKey jobKey);

        /// <summary>
        /// 查询所有任务
        /// </summary>
        /// <returns></returns>
        Task<List<SchedulerEntity>> GetJobListAsync();
    }
}